'''
=====让主窗口居中显示

面向对象的方式，将所有与ui有关的代码都放进一个类里面，
然后创建一个窗口，只要创建这个类的子类即可
'''
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5.QtGui import QIcon


class FirstMainWin(QMainWindow):
    def __init__(self, parent=None):
        super(FirstMainWin, self).__init__(parent)

        # 设置主窗口的标题
        self.setWindowTitle("第一个主窗口应用")

        # 设置窗口的尺寸
        self.resize(400, 300)
        self.status = self.statusBar()
        self.status.showMessage('只存在5秒的消息', 5000)


if __name__ == '__main__':
    app = QApplication(sys.argv)
    # app.setWindowIcon(QIcon('E:/PycharmProjects/doutula/pyqt5_/controls/images/t10.ico'))
    app.setWindowIcon(QIcon('./img/juice.png'))
    main = FirstMainWin()
    main.show()
    sys.exit(app.exec_())
